home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: Auge 4000
/
Auge 4000 #73 (1993-11-10)(Amiga User Gruppe Einzugsgebiet 4000).zip
/
Auge 4000 #73 (1993-11-10)(Amiga User Gruppe Einzugsgebiet 4000).adf
/
RSysV1.3
/
RSysV1_3.lha
/
RSysSrc.lha
/
RSysPreferenceLists.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-09-05
|
15KB
|
682 lines
/*
***************************************************************************
*
* Datei:
* RSysPreferenceLists.c
*
* Inhalt:
*
* --- Globale Routinen ---
*
* void MakeHeadEntry ( int *num , char *title );
* void MakeHexEntry ( int *num , char *title , APTR entry );
* void SysEnvList ( void );
* void SysExtPrinterData ( void );
* void SysPrefList ( void );
*
* --- Lokale Routinen ---
*
* static void MakeColEntry ( int *num , char *title , long entry );
* static void MakeMeasureEntry ( int *num , char *title , long entry , char *measure );
* static void MakeNumEntry ( int *num , char *title , long entry );
* static void MakeStringEntry ( int *num , char *title , char *entry );
* static void MakeTimeEntry ( int *num , char *title , struct timeval *tv );
*
* Bemerkungen:
* Liste der System- und Druckereinstellungen sowie der Env:-Variablen.
*
* Erstellungsdatum:
* 07-Jul-93 Rolf Böhme
*
* Änderungen:
* 07-Jul-93 Rolf Böhme Erstellung
*
***************************************************************************
*/
#include "RSys.h"
/*
* MakeNumEntry() erzeugt ein Zahleneintrag für die
* anzuzeigende Liste
*/
static void
MakeNumEntry(int *num, char *title, long entry)
{
sprintf(Entries[*num].se_Entry, "%-22s : %ld", title, entry);
AddNodeToList(*num, NO_SORT, 0);
(*num)++;
return;
}
/*
* MakeStringEntry() erzeugt ein Zeileneintrag für die
* anzuzeigende Liste
*/
static void
MakeStringEntry(int *num, char *title, char *entry)
{
sprintf(Entries[*num].se_Entry, "%-22s : %s", title, entry);
AddNodeToList(*num, NO_SORT, 0);
(*num)++;
return;
}
/*
* MakeHeadEntry() erzeugt eine Titelzeileneintrag für die
* anzuzeigende Liste
*/
void
MakeHeadEntry(int *num, char *title)
{
strcpy(Entries[*num].se_Entry, field[BLANK_FIELD]);
AddNodeToList(*num, NO_SORT, 0);
(*num)++;
strncpy(Entries[*num].se_Entry, title,BUFSIZE);
AddNodeToList(*num, NO_SORT, 0);
(*num)++;
return;
}
/*
* MakeColEntry() erzeugt ein Zahleneintrag für die
* anzuzeigende Liste in einem bestimmten Format
*/
static void
MakeColEntry(int *num, char *title, long entry)
{
sprintf(Entries[*num].se_Entry, "%-22s : 0x%04lx", title, (long)entry);
AddNodeToList(*num, NO_SORT, 0);
(*num)++;
return;
}
/*
* MakeHexEntry() erzeugt einen hexadezimalen
* Zahleneintrag für die anzuzeigende Liste
*/
void
MakeHexEntry(int *num, char *title, APTR entry)
{
sprintf(Entries[*num].se_Entry, "%-14s : 0x%08lx", title, entry);
AddNodeToList(*num, NO_SORT, 0);
(*num)++;
return;
}
/*
* MakeTimeEntry() erzeugt einen Zeiteintrag für die
* anzuzeigende Liste
*/
static void
MakeTimeEntry(int *num, char *title, struct timeval *tv)
{
sprintf(Entries[*num].se_Entry, "%-22s : %ld sec %-6ld µsec",
title, tv->tv_secs, tv->tv_micro);
AddNodeToList(*num, NO_SORT, 0);
(*num)++;
return;
}
/*
* MakeMeasureEntry() erzeugt ein Maßzahleneintrag für die
* anzuzeigende Liste
*/
static void
MakeMeasureEntry(int *num, char *title, long entry, char *measure)
{
sprintf(Entries[*num].se_Entry, "%-22s : %ld %s",
title, (long)entry, measure);
AddNodeToList(*num, NO_SORT, 0);
(*num)++;
return;
}
/*
* SysPrefList() listet die Preferenceseinstellungen auf.
* Diese werden NICHT aus den 2.0-IFF-Prefs-Dateien
* geholt, sondern mit einer Systemfunktion ausgelesen
*/
void
SysPrefList(void)
{
int i = 0;
struct Preferences PrefCopy,
*PCptr;
char *prtype = "Printer type",
*prshade = "Print shade",
*prpaper = "Paper size",
*baudrate = "Baud rate",
*parity = "Parity",
*handshake = "Handshake",
*baud = "Baud";
DPOS;
HandleHelp(MN_SysPrefList);
if (PCptr = GetPrefs(&PrefCopy, sizeof(struct Preferences)))
{
PrintHeader(PREFS, NULL);
EmptyListView();
PrintInfo("Read Preferences", NO_SPEAK, 0);
countentries = 61;
Entries = AllocScrollEntries(countentries);
strcpy(Entries[i].se_Entry, "----- Input/Keyboard:");
AddNodeToList(i++, NO_SORT, 0);
MakeTimeEntry(&i, "Keyboard repeat speed", &PCptr->KeyRptSpeed);
MakeTimeEntry(&i, "Keyboard repeat delay", &PCptr->KeyRptDelay);
MakeTimeEntry(&i, "Double click time", &PCptr->DoubleClick);
MakeHeadEntry(&i, "----- Pointer");
/* Intuition Pointer data */
MakeNumEntry(&i, "\"Hot spot\" X", (long)PCptr->XOffset);
MakeNumEntry(&i, "\"Hot spot\" Y", (long)PCptr->YOffset);
MakeColEntry(&i, "Pointer Sprite Col 0", (long)PCptr->color17);
MakeColEntry(&i, "Pointer Sprite Col 1", (long)PCptr->color18);
MakeColEntry(&i, "Pointer Sprite Col 2", (long)PCptr->color19);
MakeNumEntry(&i, "Pointer Sensitivity", (long)PCptr->PointerTicks);
MakeHeadEntry(&i, "----- Workbench");
MakeNumEntry(&i, "Height default font", (long)PCptr->FontHeight);
MakeColEntry(&i, "Standard Color 0", (long)PCptr->color0);
MakeColEntry(&i, "Standard Color 1", (long)PCptr->color1);
MakeColEntry(&i, "Standard Color 2", (long)PCptr->color2);
MakeColEntry(&i, "Standard Color 3", (long)PCptr->color3);
MakeNumEntry(&i, "View X-Offset", (long)PCptr->ViewXOffset);
MakeNumEntry(&i, "View Y-Offset", (long)PCptr->ViewYOffset);
MakeNumEntry(&i, "View init offset X", (long)PCptr->ViewInitX);
MakeNumEntry(&i, "View init offset Y", (long)PCptr->ViewInitY);
MakeNumEntry(&i, "Height default font", (long)PCptr->FontHeight);
MakeStringEntry(&i, "CLI availability",
(PCptr->EnableCLI ? "CLI enabled" : "CLI disabled"));
MakeStringEntry(&i, "Workbench interlaced",
(PCptr->LaceWB ? "Yes" : "No"));
MakeNumEntry(&i, "Override WB width", (long)PCptr->wb_Width);
MakeNumEntry(&i, "Override WB height", (long)PCptr->wb_Height);
MakeNumEntry(&i, "Override WB depth", (long)PCptr->wb_Depth);
MakeNumEntry(&i, "Extension Info size", (long)PCptr->ext_size);
MakeHeadEntry(&i, "----- Printer");
MakeStringEntry(&i, "Printer port",
(PCptr->PrinterPort ? "Serial port" : "Parallel port"));
switch (PCptr->PrinterType)
{
case 0x00:
MakeStringEntry(&i, prtype, "Custom");
break;
case 0x01:
MakeStringEntry(&i, prtype, "Alpha P101");
break;
case 0x02:
MakeStringEntry(&i, prtype, "Brother 15XL");
break;
case 0x03:
MakeStringEntry(&i, prtype, "CBM MPS1000");
break;
case 0x04:
MakeStringEntry(&i, prtype, "Diabolo 630");
break;
case 0x05:
MakeStringEntry(&i, prtype, "Diabolo ADV-D25");
break;
case 0x06:
MakeStringEntry(&i, prtype, "Diabolo C-150");
break;
case 0x07:
MakeStringEntry(&i, prtype, "Epson");
break;
case 0x08:
MakeStringEntry(&i, prtype, "Epson JX-80");
break;
case 0x09:
MakeStringEntry(&i, prtype, "Okimate 20");
break;
case 0x0A:
MakeStringEntry(&i, prtype, "Qume-LP 20");
break;
case 0x0B:
MakeStringEntry(&i, prtype, "HP-Laserjet");
break;
case 0x0C:
MakeStringEntry(&i, prtype, "HP-Laserjet +");
break;
default:
MakeStringEntry(&i, prtype, "Unknown");
break;
}
MakeStringEntry(&i, "Printer Driver", (char *)PCptr->PrinterFilename);
MakeNumEntry(&i, "Print pitch", (long)PCptr->PrintPitch);
MakeStringEntry(&i, "Print quality",
(PCptr->PrintQuality ? "Letter" : "Draft"));
MakeStringEntry(&i, "Lines per inch",
(PCptr->PrintSpacing ? "8 LPI" : "6 LPI"));
MakeNumEntry(&i, "Left margin", (long)PCptr->PrintLeftMargin);
MakeMeasureEntry(&i, "Right margin", (long)PCptr->PrintRightMargin,
"Chars");
MakeStringEntry(&i, "Print image",
(PCptr->PrintImage ? "Negative" : "Positive"));
MakeStringEntry(&i, "Print aspect",
(PCptr->PrintImage ? "Vertical" : "Horizontal"));
switch (PCptr->PrintShade)
{
case 0:
MakeStringEntry(&i, prshade, "Black/White");
break;
case 1:
MakeStringEntry(&i, prshade, "Grey scale");
break;
default:
MakeStringEntry(&i, prshade, "Color");
break;
}
MakeNumEntry(&i, "Print Threshold", (long)PCptr->PrintThreshold);
switch (PCptr->PaperSize)
{
case US_LETTER:
MakeStringEntry(&i, prpaper, "USA Letter");
break;
case US_LEGAL:
MakeStringEntry(&i, prpaper, "USA Legal");
break;
case N_TRACTOR:
MakeStringEntry(&i, prpaper, "Narrow tractor");
break;
case W_TRACTOR:
MakeStringEntry(&i, prpaper, "Wide tractor");
break;
case CUSTOM:
MakeStringEntry(&i, prpaper, "Custom width");
break;
}
MakeMeasureEntry(&i, "Paper length", (long)PCptr->PaperLength,
"Rows");
MakeStringEntry(&i, "Paper type",
(PCptr->PaperType ? "Single paper" : "Fanfold paper"));
MakeStringEntry(&i, "Temp file for printer",
((PCptr->WorkName != NULL) ? (char *)PCptr->WorkName :
(char *)"None"));
MakeNumEntry(&i, "Affect Rows/Columns", (long)PCptr->RowSizeChange);
sprintf(Entries[i].se_Entry, "User preference flags : 0x%08lx",
PCptr->PrintFlags);
AddNodeToList(i++, NO_SORT, 0);
MakeMeasureEntry(&i, "Max width of picture", (long)PCptr->PrintMaxWidth / 10,
"inch");
MakeMeasureEntry(&i, "Max height of picture", (long)PCptr->PrintMaxHeight / 10,
"inch");
MakeMeasureEntry(&i, "Offset of picture", (long)PCptr->PrintXOffset / 10,
"inch");
MakeNumEntry(&i, "Print density", (long)PCptr->PrintDensity);
MakeHeadEntry(&i, "----- Serial configuration");
switch (PCptr->BaudRate)
{
case 0x00:
MakeMeasureEntry(&i, baudrate, 110L, baud);
break;
case 0x01:
MakeMeasureEntry(&i, baudrate, 300L, baud);
break;
case 0x02:
MakeMeasureEntry(&i, baudrate, 1200L, baud);
break;
case 0x03:
MakeMeasureEntry(&i, baudrate, 2400L, baud);
break;
case 0x04:
MakeMeasureEntry(&i, baudrate, 4800L, baud);
break;
case 0x05:
MakeMeasureEntry(&i, baudrate, 9600L, baud);
break;
case 0x06:
MakeMeasureEntry(&i, baudrate, 19200L, baud);
break;
case 0x07:
MakeStringEntry(&i, baudrate, "MIDI (31.250 baud)");
break;
default:
MakeStringEntry(&i, baudrate, (char *)field[NO_BAUD]);
break;
}
MakeNumEntry(&i, "Read bits", (long)SRBNUM(PCptr->SerRWBits));
MakeNumEntry(&i, "Write bits", (long)SWBNUM(PCptr->SerRWBits));
MakeNumEntry(&i, "Stop bits", (long)SSBNUM(PCptr->SerStopBuf));
switch (SPARNUM(PCptr->SerParShk))
{
case SPARITY_NONE:
MakeStringEntry(&i, parity, "None");
break;
case SPARITY_EVEN:
MakeStringEntry(&i, parity, "Even");
break;
case SPARITY_ODD:
MakeStringEntry(&i, parity, "Odd");
break;
default:
MakeStringEntry(&i, parity, (char *)field[NO_PARITY]);
break;
}
switch (SHAKNUM(PCptr->SerParShk))
{
case SHSHAKE_XON:
MakeStringEntry(&i, handshake, "XOn/XOff");
break;
case SHSHAKE_RTS:
MakeStringEntry(&i, handshake, "RTS/CTS");
break;
case SHSHAKE_NONE:
MakeStringEntry(&i, handshake, "None");
break;
default:
MakeStringEntry(&i, handshake, (char *)field[NO_HANDSHK]);
break;
}
}
else ErrorHandle("GetPrefs()", ENV_ERR, INFO_FAIL, NO_KILL);
PrintStatistics();
return;
}
/*
* SysEnvList() erzeugt eine Liste aller Dateien
* (Environmentvariablen) im Verzeichnis ENV:
*/
void
SysEnvList(void)
{
int i;
UBYTE envline[MAXFULLNAME+1];
char envname[ENVLEN+1], envfullname[MAXFULLNAME];
struct ExAllControl *eac;
struct ExAllData *EAData,
*ead;
int more;
long s;
int d = 0;
BPTR lock;
int ftyp;
DPOS;
HandleHelp(MN_SysEnvList);
PrintHeader(ENVVARS, NULL);
EmptyListView();
if (lock = Lock((UBYTE *) "ENV:", ACCESS_READ))
{
countentries = SizeOfDir(lock, &s, &d);
countentries += d;
if (NoEntries())
{
UnLock(lock);
return;
}
Entries = AllocScrollEntries(countentries);
i = 0;
if (eac = AllocDosObject(DOS_EXALLCONTROL, NULL))
{
eac->eac_LastKey = 0;
EAData = MyAllocVec((MAXLARGEMEM+1) * sizeof(struct ExAllData),
MEMF_ANY | MEMF_CLEAR, NO_KILL);
if (EAData)
{
do
{
more = ExAll(lock, EAData, MAXLARGEMEM * sizeof(struct ExAllData),
ED_TYPE, eac);
if ((!more) && (IoErr()!= ERROR_NO_MORE_ENTRIES))
{
ErrorHandle("ENV:", DOS_EXALL_ERR, EXALL_FAIL, NO_KILL);
break;
}
if (eac->eac_Entries == 0)
continue;
ead = EAData;
do
{
strncpy(envname, (char *)ead->ed_Name, ENVLEN);
envname[ENVLEN] = STRINGEND;
sprintf(envfullname,"ENV:%s",envname);
ftyp = filetype((char *)envfullname);
if(ead->ed_Type > 0)
sprintf(Entries[i].se_Entry,EntryAttr[ENVVARS].ea_dataformat,
envname, "<dir>");
else if(ftyp == TYPE_TEXT)
{
if (GetVar((STRPTR)envname, envline, MAXFULLNAME,GVF_GLOBAL_ONLY) > 0)
{
envline[MAXSTRLEN-1] = STRINGEND;
sprintf(Entries[i].se_Entry, EntryAttr[ENVVARS].ea_dataformat,
envname, (char *)envline);
}
else
sprintf(Entries[i].se_Entry,
EntryAttr[ENVVARS].ea_dataformat,
envname, "<env error>");
}
else
sprintf(Entries[i].se_Entry,
EntryAttr[ENVVARS].ea_dataformat,
envname, "<no text>");
AddNodeToList(i++, SORT, 0);
ead = ead->ed_Next;
}
while (ead && (i < countentries));
}
while (more && (i < countentries));
MyFreeVec(EAData);
}
FreeDosObject(DOS_EXALLCONTROL, eac);
}
else ErrorHandle("AllocDosObject()", MEMORY_ERR, ALLOC_FAIL, NO_KILL);
UnLock(lock);
}
else
{
ErrorHandle("ENV:-Lock", ENV_ERR, FIND_FAIL, NO_KILL);
return;
}
PrintStatistics();
return;
}
void
SysExtPrinterData(void)
{
union printerIO
{
struct IOStdReq ios;
struct IODRPReq iodrp;
struct IOPrtCmdReq iopc;
} *PIO;
struct MsgPort *PrinterMP;
struct PrinterData *PD;
struct PrinterExtendedData *PED;
int i = 0;
DPOS;
HandleHelp(MN_SysExtPrinterData);
PrintHeader(PRINTERDATA, NULL);
EmptyListView();
countentries = 13;
Entries = AllocScrollEntries(countentries);
if (PrinterMP = (struct MsgPort *) CreateMsgPort())
{
if (PIO = (union printerIO *) CreateExtIO(PrinterMP,
sizeof(union printerIO)))
{
if (!(OpenDevice((STRPTR)"printer.device", 0,
(struct IORequest *) PIO, 0)))
{
PD = (struct PrinterData *) PIO->iodrp.io_Device;
PED = (struct PrinterExtendedData *) &PD->pd_SegmentData->ps_PED;
MakeStringEntry(&i,"Printer name",PED->ped_PrinterName);
MakeNumEntry(&i,"Version",(long)PD->pd_SegmentData->ps_Version);
MakeNumEntry(&i,"Revision",(long)PD->pd_SegmentData->ps_Revision);
MakeNumEntry(&i,"Printer class",(long)PED->ped_PrinterClass);
MakeNumEntry(&i,"Color class",(long)PED->ped_ColorClass);
MakeNumEntry(&i,"Print columns",(long)PED->ped_MaxColumns);
MakeNumEntry(&i,"Char sets",(long)PED->ped_NumCharSets);
MakeNumEntry(&i,"Print head pins",(long)PED->ped_NumRows);
MakeMeasureEntry(&i,"Max X-dots in dump",PED->ped_MaxXDots,"dots");
MakeMeasureEntry(&i,"Max Y-dots in dump",PED->ped_MaxYDots,"dots");
MakeMeasureEntry(&i,"Density X",(long)PED->ped_XDotsInch,"dots/inch");
MakeMeasureEntry(&i,"Density Y",(long)PED->ped_YDotsInch,"dots/inch");
MakeMeasureEntry(&i,"Timeout",(long)PED->ped_TimeoutSecs,"sec");
CloseDevice((struct IORequest *) PIO);
}
DeleteExtIO((struct IORequest *) PIO);
}
DeleteMsgPort((struct MsgPort *) PrinterMP);
}
PrintStatistics();
return;
}